package com.itheima.Stream流;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @Author 王加鑫
 * @Date 2021/5/17 15:02
 * @Version 1.0
 */
public class Demo04 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(List.of("zhangsan,23","lisi,24","wangwu,25"));
        Map<String,Integer> map = list.stream().filter(s ->  Integer.parseInt(s.split(",")[1]) >= 24).collect(Collectors.toMap(
                s -> s.split(",")[0],
                s -> Integer.parseInt(s.split(",")[1])
        ));

        System.out.println(map);
    }
}
